S-Lang (programming library)

The S-Lang programming library is a software library for Unix, Windows, VMS, OS/2, and Mac OS X. It provides routines for embedding an interpreter for the S-Lang scripting language, and components to facilitate the creation of text-based applications. The latter class of functions include routines for constructing and manipulating keymaps, an interactive line-editing facility, and both low and high-level screen/terminal management functions. It is distributed under the terms of the GNU General Public License.

Contents

Brief history

The S-Lang programming library was started in 1991 by John E. Davis as a convenient way to reuse code among several of his software projects. The earliest version of the library contained input/output routines for interacting with computer terminals, and included an implementation of a simple stack-based interpreter with a postscript-like syntax that he developed for use in a scientific plotting program. The JED text-editor was the first program to both embed the interpreter and use the terminal I/O components of the library.

Interpreter

The bulk of what makes up the S-Lang library is its interpreter, and it is also where most of the development takes place. Although the original syntax supported by the interpreter resembled postscript, the syntax has evolved to be much more C-like, with additional support for object-oriented style constructs. As a reflection of Davis's background in Physics and professional interest in Scientific Computing, the language natively supports many vectorized array-based operations familiar to Matlab and IDL users.

Up until the release of version 2.0, Davis had always advocated that the interpreter be embedded into applications to make them extensible. That is, using the interpreter meant either writing a C program that embedded it, or using it in the context of another application (e.g., the JED editor). In this sense, a standalone program called the S-Lang interpreter did not exist. Version 2.0 was released in 2005 with an interactive version of the S-Lang shell, slsh, which until then was distributed as a demo program that was capable of little more than running non-interactive scripts. Since then slsh has evolved into an application in its own right, and has had a number of external modules developed for use by it. As such, it has become the S-Lang interpreter.

Screen Management

In the mid-1990s while porting the sc spreadsheet to the S-Lang library, Davis developed the library's screen management facility. This component was designed to optimize screen output (by minimizing the number of characters sent to the terminal), and provide a simple way of supporting a variety of terminals through an extra layer of abstraction between the application code and the terminal. The slrn newsreader was the first application to make full use of this interface. Since then a number of other programs (e.g., Mutt) have taken advantage of this feature of the library, and it has become perhaps arguably the most used aspect of the library. Since version 2.0, the screen management routines have had transparent support for UTF-8.

See also

External links